@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";

	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});

	function initGrid(){
		var grid_url = ctx + "/${code}/checkslist";
		var _colnames = ["项目名称",
			"申报单位",
			"责任单位",
			"建设起止年限",
			"建设结束时间",
			"预算（万）",
			"申报进度",
			"审核意见",
			"操作"
		];
		var _colmodel = [{name:"name", index:"name", width:100,formatter:function (value, row, index) {
			return '<a href="#" class="btn btn-btn btn-info btn-xs" onclick="view('+"'"+index.id+"'"+')">'+value+'</a>';
		}},
			{name:"fullname", index:"fullname", width:100},
			{name:"responsible", index:"responsible", width:100},
			{name:"start", index:"start", width:100 ,formatter:function (value, row, index) {
				var over = index.over;
				var start = value;
				if(start !== null && over!==null){
					return start.substr(0,7)+" 至 "+over.substr(0,7);
				}else{
					return "未录入";
				}

			}},
			{name:"over", index:"over", width:100,hidden:true},
			{name:"budget", index:"budget", width:100},
			{name:"dict", index:"dict", width:100 },
			{name:"audit_opinion", index:"audit_opinion", width:100},
			{name:"temarks", width:100,formatter:function (value,row,index) {
				var status = index.status
				if(status === 16){
					return '<a href="#" class="btn btn-btn btn-warning btn-xs" onclick="check_source('+"'"+index.id+"'"+')">'+"固定资产库"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-warning btn-xs" onclick="check_add('+"'"+index.id+"'"+')">'+"申请中期检查"+'</a>';
				}else if(status === 17){
					return '<a href="#" class="btn btn-btn btn-warning btn-xs" onclick="check_source('+"'"+index.id+"'"+')">'+"固定资产库"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-warning btn-xs" onclick="check_add('+"'"+index.id+"'"+')">'+"再次申请中期检查"+'</a>'+
							'<a href="#" class="btn btn-btn btn-success btn-xs" onclick="check_over('+"'"+index.id+"'"+')">'+"申请最终验收"+'</a>';

				}else {
					return" ";
				}

			}}
		];

		jQuery(grid_selector).jqGrid({
			url : grid_url,
			shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel,
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
	check_source = function (entId) {
		window.location.href="/source/index?id="+ entId;
	};
	check_add = function (entId) {
		window.location.href="/myproject/checksadd/"+ entId;
	};
	check_over = function (entId) {
		window.location.href="/myproject/checksover/"+ entId;
	};
	function view(pid){
		var index = layer.open({
			type: 2,
			title:'查看详情',
			area: ['90%', '70%'],
			maxmin:true,
			shadeClose: true, //点击遮罩关闭

			content:  '/projects/view?id=' + pid
		});

		this.layerIndex = index;
	}
</script>


<!-- 配置 grid -->
<div class="row">
	<div class="col-xs-12 tb-grid">
		<!-- 配置 查询 -->
		@ var _col=[
		@		{name:"主键", index:"id", type:"text"},
		@		{name:"申报单位", index:"dept_id", type:"text"},
		@		{name:"联系人", index:"contact", type:"text"},
		@		{name:"联系电话", index:"phone", type:"text"},
		@		{name:"责任单位", index:"responsible", type:"text"},
		@		{name:"建设开始时间", index:"start", type:"text"},
		@		{name:"建设结束时间", index:"over", type:"text"},
		@		{name:"预算（万）", index:"budget", type:"text"},
		@		{name:"备注", index:"temarks", type:"text"}
		@];
		@ include("/common/_function/_search.html",{"col":_col}){}
		<!-- 按钮 -->
		<div class="welljq well-sm" id="btns"></div>
		<!-- grid -->
		<table id="grid-table"></table>
		<!-- 分页-->
		<div id="grid-pager"></div>
	</div>
</div>

<!-- 引入所需的js -->
@include("/common/_listscript.html"){}

@}	